// 1.0 导入vue核心包
import Vue from 'vue';

// 2.0 导入App.vue的vue对象
import App from './App.vue';

import vueRouter from 'vue-router';

Vue.use(vueRouter);

import home from './components/Home.vue'; //首页
import shopcar from './components/shopcar/car.vue'; //购物车页面
import newslist from './components/news/newslist.vue'; //新闻页面
import newsinfo from './components/news/newsinfo.vue'; //新闻详情页面
import photolist from './components/photo/photolist.vue'; //图片分享
import photoinfo from './components/photo/photoinfo.vue'; //图片详情页面
import goodslist from './components/goods/goodslist.vue';
import goodsinfo from './components/goods/goodsinfo.vue';
import goodsdesc from './components/goods/goodsdesc.vue';
import goodscomment from './components/goods/goodscomment.vue';
console.log(newsinfo);

var router = new vueRouter({
  linkActiveClass: 'mui-active',
  routes: [{
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      component: home
    }, //首页
    {
      path: '/shopcar',
      component: shopcar
    }, //购物车页面
    {
      path: '/news/newslist',
      component: newslist
    }, //新闻页面
    {
      path: '/news/newsinfo/:id',
      component: newsinfo
    }, //新闻详情页面
    {
      path: '/photo/photolist',
      component: photolist
    },
    {
      path: '/photo/photoinfo/:id',
      component: photoinfo
    },
    {
      path: '/goods/goodslist',
      component: goodslist
    },
    {
      path: '/goods/goodsinfo/:id',
      component: goodsinfo
    },
    {
      path: '/goods/goodsdesc/:id',
      component: goodsdesc
    },
    {
      path: '/goods/goodscomment/:id',
      component: goodscomment
    }
  ]

})

import 'mint-ui/lib/style.min.css';
// 导入mint-ui组件对象
import mintui from 'mint-ui';
// 在Vue中全局使用mintui
Vue.use(mintui);

// 5.0 注册mui的css样式
import '../statics/mui/css/mui.css';

import '../statics/css/site.css'

// 6.0导入vue-resource进行ajax数据请求

import vueResource from 'vue-resource';

// 绑定vueResource

Vue.use(vueResource);

// 7.0实现全局过滤器

// 导入所依赖的文件moment
import moment from 'moment';

// 定义全局过滤器

Vue.filter('datefmt', function (input, fmtstring) {

  return moment(input).format(fmtstring);

})

//使用vue-preview

import VuePreview from 'vue-preview';

Vue.use(VuePreview);



// 3.0 利用Vue对象进行解析渲染
new Vue({
  el: '#app',
  router,
  // render:function(create){create(App)} //es5的写法
  render: c => c(App) // es6的函数写法 =>：goes to
});